package com.saxon.Dao;

import com.saxon.pojo.User;
import org.mybatis.spring.support.SqlSessionDaoSupport;


public class UserDaoImpl extends SqlSessionDaoSupport implements UserDao {

    @Override
    public User getUser (int id) {
        delete (id - 1);
        return this.getSqlSession ().getMapper (UserDao.class).getUser (id);
    }

    @Override
    public void delete (int id) {
        this.getSqlSession ().getMapper (UserDao.class).delete (id);
    }

    @Override
    public void insert (User u) {
        this.getSqlSession ().getMapper (UserDao.class).insert (u);
    }

    @Override
    public void sql (int id, User u) {
        insert (u);
        delete (id - 1);
        System.out.println (getUser (id));
    }
}
